package com.sxz.sbs.util;

import android.app.Activity;
import android.support.design.widget.TabLayout;
import android.view.View;

import com.sxz.sbs.R;
import com.sxz.sbs.widget.CommonTitle;

/**
 * Created by hp on 2018/1/16.
 */

public class CommonTabLayoutTitle {

    public void setTabLayoutTitle(Activity activity, String type, TabLayout tabLayout, int size){
        tabLayout.addTab(tabLayout.newTab().setText("全部"));
        tabLayout.addTab(tabLayout.newTab().setText("一星"));
        tabLayout.addTab(tabLayout.newTab().setText("二星"));
        tabLayout.addTab(tabLayout.newTab().setText("三星"));
        tabLayout.addTab(tabLayout.newTab().setText("四星"));
        tabLayout.addTab(tabLayout.newTab().setText("五星"));
        if (type.equals("valType=1&valStatus=0")){
            setTitle(activity,"未拨打("+size+")");
            tabLayout.setVisibility(View.GONE);
        }else if (type.equals("valType=3&valStatus=0")){
            setTitle(activity,"无意向("+size+")");
            tabLayout.setVisibility(View.GONE);
        }else if (type.equals("valType=2&valStatus=0")){
            setTitle(activity,"有意向("+size+")");
            tabLayout.setVisibility(View.VISIBLE);
        }else if (type.equals("valType=0&valStatus=4")){
            setTitle(activity,"已交定金("+size+")");
            tabLayout.setVisibility(View.VISIBLE);
        }else if (type.equals("valType=0&valStatus=5")){
            setTitle(activity,"交易完成("+size+")");
            tabLayout.setVisibility(View.GONE);
        }else if (type.equals("")){
            setTitle(activity,"全部用户("+size+")");
        }
    }

    private void setTitle(Activity mactivity,String str){
        new CommonTitle.Builder(mactivity).setTitle(str).showLeftReadyImg(R.drawable.ic_search_left).showRightReadyImg(R.drawable.ic_adds).build().show();
    }
}
